package com.woniuxy.carrental.controller;

import com.woniuxy.carrental.entity.PageBean;
import com.woniuxy.carrental.entity.ResponseResult;
import com.woniuxy.carrental.entity.Wareing;
import com.woniuxy.carrental.service.WareingService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author author
 * @create 2021-10-12 11:27
 * 肖某的入库记录表单
 */
@CrossOrigin  //解决跨域
@RestController  //要求返回json格式数据异步使用
public class WareingController {
    //获取service实例
    @Resource
    WareingService wareingService;

    //使用分页查询表单中的数据
    @GetMapping("/selectWareing")
    public ResponseResult<PageBean<Wareing>> selectWareingAll(Wareing wareing,
    int pageSize,int pageIndex){
        return wareingService.selectDetailsByPageService(wareing, pageIndex, pageSize);
    }

    //删除
    @DeleteMapping("/deleteWareing/{wareingid}")
    public String deleteWareingById(@PathVariable String wareingid){
        System.out.println(wareingid);
    wareingService.deleteWareingService(wareingid);
    return "删除成功！";
    }

    //查询表单中所有状态
}
